package com.wuchao.spring.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;

import java.util.Arrays;

/**
 * @Author wuchao66
 * @Date 2022/7/1 11:21
 * @Version 1.0
 */
@Slf4j
public class TheAop {//切面
    public void before(JoinPoint jp) {
        log.info("调用" + jp.getTarget() + "的" + jp.getSignature().getName() + "方法。方法入参:" + Arrays.toString(jp.getArgs()));
    }
    public void afterReturning(JoinPoint jp, Object result) {
        log.info("调用" + jp.getTarget() + "的" + jp.getSignature().getName() + "方法。方法返回值:" + result);
    }
    public void afterThrowing(Exception e){
        log.info("报错了");
    }

}
